import { request } from '../request/index'

const getUserInfo = async (ids) => {
  // let idss = null
  // ids.forEach((item, index) => {
  //   if(typeof item != String) {
  //     ids[index] = item + ''
  //   }
  // })
  const { data: res } = await request({
    url: `/usersInfo/ids`,
    data: ids,
    method: 'post'
  })
  let uInfo = []
  let users = res.data
  users.forEach(item => {
    const user = {
      id: item.id,
      headpic: item.headpic.split('"')[1],
      username: item.nickname.split('"')[1],
      fans: item.fans
    }
    uInfo.push(user)
  })
  return uInfo
}

export default getUserInfo
